<extend name="Public:base" />

<block name="content">

    <div class="table-responsive">

    </div>

    <div class="table-responsive">

            <table class="table table-striped table-bordered table-hover" id="mytable">

                <tbody>
                <volist name="list" id="ba">
                    <tr>
                        <td>{$ba.name}</td>
                        <td><input id="{$ba.id}" type="text" value="{$ba.url}"></td>
                        <td><button  style="{$update==1?'':'display: none'}" class="btn btn-info btn-xs radius5" onclick="upda({$ba.id})">修改</button></td>
                    </tr>
                </volist>
                <tr>
                    <td colspan="20" class="page">{$page}</td>
                </tr>
                </tbody>

            </table>
        </form>
    </div>

</block>
<block name="javascript">
    <script>
       function upda(id){
           $.ajax({
               url:"{:U('BasisSet/upda')}",
               type:'post',
               data:{
                   url:$('#'+id).val(),
                   id:id
               },
               success:function(data){
                   console.log(data)
                   if(data==2){
                       $.jbox.info("修改成功！", 'loading');
                   }else{
                       $.jbox.info("非法网址！", 'loading');
                   }
                   window.setTimeout(function () {window.location.href="{:U('BasisSet/index')}"; }, 500);
               }
           })
       }
    </script>
</block>